package com.lagou.edu.config;


import com.lagou.edu.interceptor.SecurityInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebConfig implements WebMvcConfigurer {

    @Autowired
    private SecurityInterceptor securityInterceptor;

    /**
     * 加载拦截器
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        // 加载鉴权
        registry.addInterceptor(securityInterceptor).addPathPatterns("/**").excludePathPatterns("/", "/login", "/login/error");
    }
}